package com.springcloud.minio.feign;

import com.springcloud.commom.api.R;
import com.springcloud.commom.constant.AppConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(value = AppConstant.MINIO_SERVICE_NAME, fallback = MinioClientFallback.class)
public interface IMinioClient {

    String API_PREFIX = "/minio";

    @PostMapping(value = API_PREFIX + "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    R upload(@RequestBody MultipartFile file);

    @GetMapping(API_PREFIX + "getUrl")
    R getUrl(@RequestParam("fileName") String fileName);
}
